package com.itheima.test;

import java.util.Scanner;

//int num 1234567
public class homework {
    public static void main(String[] args) {
        System.out.println();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个位数");
        int a = sc.nextInt();
        int number = 123456789;
        /*int num = 1;
        int divisor = 1;
        while (num < a) {
            divisor = divisor * 10;
            num++;
        }
        System.out.println(number / divisor % 10);*/
        int divisor = 1;
        for (int num = 1; num < a; num++){
            divisor = divisor * 10;
        }
        System.out.println(number / divisor % 10);
    }

}
/* if (a == 1){
            System.out.println(number / 1 % 10);
        }else if (a == 2){
            System.out.println(number / 10 % 10);
        }*/
